package top.lingkang.securityoauth2.server.auth.impl;

import top.lingkang.securityoauth2.core.entity.DefaultUserDetail;
import top.lingkang.securityoauth2.core.entity.UserDetail;
import top.lingkang.securityoauth2.server.auth.UserDetailService;
import top.lingkang.securityoauth2.server.error.ServerLoginException;

/**
 * @author lingkang
 * Created by 2022/7/8
 */
public class DefaultUserDetailService implements UserDetailService {
    @Override
    public UserDetail login(String username, String password) {
        if ("admin".equals(username)) {
            return new DefaultUserDetail("admin", "1", new String[]{});
        }
        throw new ServerLoginException("Account or password error, 账号或密码错误！");
    }
}
